package com.mes.task.dao;

import java.util.Date;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.bstek.dorado.data.provider.Page;
import com.mes.common.dao.BasicDao;
import com.mes.task.dao.iface.IWorkRecordDao;
import com.mes.task.domain.WorkRecord;

@Repository
public class WorkRecordDao extends BasicDao<WorkRecord> implements IWorkRecordDao {
	
	@Override
	public int getWorkRecordCountByAssnDeviceUid(String assignmentUid) throws Exception{
		Session session = this.getSessionFactory().getCurrentSession();
		try {
			String hql = "select count(*) from WorkRecord where assignmnetUid = :assignmentUid";
			Query query = session.createQuery(hql);
			query.setString(0, assignmentUid);
			int workRecordCount = ((Integer)query.uniqueResult()).intValue();
			
			return workRecordCount;
		} finally {
			session.flush();
		}
	}

	@Override
	public List<WorkRecord> getWorkRecords(String deptUid, Date fromDate, Date toDate, Page page) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<WorkRecord> getDeviceWorkRecords(String deviceUid, Date fromDate, Date toDate, Page page) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<WorkRecord> getTaskWorkRecordsByEmployee(String taskUid, String employeeUid) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<WorkRecord> getUnCheckedTaskWorkRecordsByEmployee(String taskUid, String employeeUid) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<WorkRecord> getTaskWorkRecords(String taskUid) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<WorkRecord> getUnCheckedTaskWorkRecords(String taskUid) {
		// TODO Auto-generated method stub
		return null;
	}
	
	
	
}
